package com.ruoyi.admin.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.admin.mapper.SysUserDtoMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.admin.mapper.MlOrderDtoMapper;
import com.ruoyi.admin.domain.MlOrderDto;
import com.ruoyi.admin.service.IMlOrderDtoService;

/**
 * 订单Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-18
 */
@Service
public class MlOrderDtoServiceImpl extends ServiceImpl<MlOrderDtoMapper, MlOrderDto> implements IMlOrderDtoService
{
    @Autowired
    private MlOrderDtoMapper mlOrderDtoMapper;

    //订单和商品信息关联查询所有商品信息
    @Override
    public Map<String, Object> selectGoodsInfoWhereUserId(Long userId) {
        Map<String,Object> result = new HashMap<>();
        List<MlOrderDto> orderAndGoodsList=mlOrderDtoMapper.selectGoodsInfoWhereUserId(userId);
        result.put("orderAndGoodsList",orderAndGoodsList);
        return result;
    }

    /**
     * 查询订单
     * 
     * @param id 订单主键
     * @return 订单
     */
    @Override
    public MlOrderDto selectMlOrderDtoById(Long id)
    {
        return mlOrderDtoMapper.selectMlOrderDtoById(id);
    }

    /**
     * 查询订单列表
     * 
     * @param mlOrderDto 订单
     * @return 订单
     */
    @Override
    public List<MlOrderDto> selectMlOrderDtoList(MlOrderDto mlOrderDto)
    {
        return mlOrderDtoMapper.selectMlOrderDtoList(mlOrderDto);
    }

    /**
     * 新增订单
     * 
     * @param mlOrderDto 订单
     * @return 结果
     */
    @Override
    public int insertMlOrderDto(MlOrderDto mlOrderDto)
    {
        return mlOrderDtoMapper.insertMlOrderDto(mlOrderDto);
    }

    /**
     * 修改订单
     * 
     * @param mlOrderDto 订单
     * @return 结果
     */
    @Override
    public int updateMlOrderDto(MlOrderDto mlOrderDto)
    {
        return mlOrderDtoMapper.updateMlOrderDto(mlOrderDto);
    }

    /**
     * 批量删除订单
     * 
     * @param ids 需要删除的订单主键
     * @return 结果
     */
    @Override
    public int deleteMlOrderDtoByIds(Long[] ids)
    {
        return mlOrderDtoMapper.deleteMlOrderDtoByIds(ids);
    }

    /**
     * 删除订单信息
     * 
     * @param id 订单主键
     * @return 结果
     */
    @Override
    public int deleteMlOrderDtoById(Long id)
    {
        return mlOrderDtoMapper.deleteMlOrderDtoById(id);
    }
}
